package com.sc.oa.base;

public class Pager {
	int pn=1;//
	int pagesize=10;//
	int rows=0;//
	int pages=1;//
	public int getPn() {
		return pn;
	}
	public void setPn(int pn) {
		if(pn<=0){
			pn=1;
		}
		this.pn = pn;
	}
	public int getPagesize() {
		return pagesize;
	}
	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public int getPages() {
		return pages;
	}
	public void setPages(int pages) {
		this.pages = pages;
	}
	public void init(int _rows){
		rows=_rows;
		pages=rows%pagesize==0?rows/pagesize:rows/pagesize+1;			
		if(pn>pages){
			pn=pages;
		}
	}
	public int getStartRow(){
		return (pn-1)*pagesize;
	}
}
